//
//  FilterCollectionViewCell.m
//  图片故事
//
//  Created by 周涛 on 16/2/26.
//  Copyright © 2016年 helloApp. All rights reserved.
//

#import "FilterCollectionViewCell.h"
#import "Header.h"

@interface FilterCollectionViewCell ()

@end

@implementation FilterCollectionViewCell

- (instancetype) initWithFrame:(CGRect)frame {

    if (self = [super initWithFrame:frame]) {
        
        // 初始化控件
        _filterImageView = [[UIImageView alloc] init];
        
        [self.contentView addSubview:_filterImageView];
        
        _nameLabel = [[UILabel alloc] init];
        
        [_nameLabel setBackgroundColor:[UIColor colorWithWhite:0.8 alpha:0.5]];
        
        [_nameLabel setTextAlignment:NSTextAlignmentCenter];
        
        [_nameLabel setFont:[UIFont systemFontOfSize:12]];
        
        [_nameLabel setTextColor:[UIColor whiteColor]];
        
        [self.contentView addSubview:_nameLabel];
    }
    
    return self;
}

- (void) layoutSubviews {
    [super layoutSubviews];
    
    //  设置子控件的位置
    [_filterImageView setFrame:CGRectMake(0, 0, My_Height(80), My_Height(100))];
    
    [_nameLabel setFrame:CGRectMake(0, My_Height(80), My_Height(80), My_Height(20))];
}

- (void)setFilterModel:(FilterModel *)filterModel {
    
    // 设置子控件数据
    [_filterImageView setImage:[UIImage imageNamed:filterModel.filterImage]];
    
    [_nameLabel setText:filterModel.filterTitle];
}

@end
